<?php
session_start();
?>
<html>
<head>
<meta charset = "utf-8" />
<title>小树林BBS</title>
<link rel = "stylesheet" href = "main.css" style = "text/css" />
<script type="text/javascript" src = "jquery-1.7.1.js"></script>
<script>
$(function(){
	$("#username").focus();

	$("#login_bt").click(function(){
		var username = $("#username").val();
		var password = $("#password").val();
		
/*
		$.ajax({
			type:"POST",
			url:"login_js2.php/?action=login",
			dataType:"json",
			data:{"username":username,"password":password},
			success:function(json){
				if(json.success==1){
					$(".login_div").remove();
					var div = "<form>"+
							"<tr>"+
								"<td>"+json.name+"</td>"+
							"</tr>"+
							"<tr>"+
								"<td>"+json.msg+"</td>"+
							"</tr>"+
						"</form>";

					$(".hehe").append(div);		
				}
				else {
					$(".hehe").remove();
				}
			}

		});

*/	
	 


	});

});

</script>
<script>
function check_login_name(form){
	if(form.username.value=="")
	{
		alert("用户名不能为空");
		form.username.focus();
		return(false);
	}
	if(form.password.value=="")
	{
		alert("密码不能为空");
		form.password.focus();
		return(false);
	}
	if(form.password.value.length<6)
	{
		alert("密码至少应是6位");
		form.password.focus();
		return(false);
	}
	if(form.username.value.length<4)
	{
		alert("用户名至少是4位");
		form.username.focus();
		return(false);
	}
}

</script>
</head>
<body>
<div class = "header">
	<ul>
		<li><a href = "#">学信网</a></li>
		<li><a href = "#">中央大学新闻网</a></li>
		<li><a href = "#" title = "http://bbs.nju.edu.cn">中央大学</a></li>
		<li><a href = "#">联系我们</a></li>
		<li><a href = "#">加入收藏夹</a></li>
		<li><a href = "#">设为首页</a></li>

	</ul>

</div>

<div class = "side_bar">
	<?php
		if(!isset($_SESSION["current_user"])) {
	?>
		<div class = "login_div">
		<form class = "login_form" action = "login_save.php" method = "post" name = "login_form" onsubmit="return check_login_name(this);" >
		<input type = "text" name = "username" id = "username" placeholder = "用户名" />
		<br />
		<input type = "password" name = "password" id = "password" placeholder = "密码"/>
		<input type = "submit" name = "login_bt" value = "登陆" id = "login_bt" onclick="check_login_name(login_form)" />
		<a href = "reg2.php" class = "tips_reg">注册</a>
		</form>
		</div>

	<?php
		}
		else {		
	?>
		<div class = "logined">
		<p><strong><?php echo $_SESSION["current_user"]; ?></strong>,欢迎回来!</p>
		<p>这是您第<strong><?php echo $_SESSION["login_count"]; ?></strong>次登录</p>
		<p>您上次登录时间是：<strong><?php echo $_SESSION["lastlogintime"]; ?></strong></p>
		<p><a href = "logout.php" id = "logout">退出</a></p>
		</div>
	<?php  } ?>
 
	<ul>
		<li><a href = "#">首页</a></li>
		<li><a href = "#">全站十大</a></li>
		<li><a href = "#">各区热点</a></li>
		<li><a href = "#">我的版面</a></li>
		<li><a href = "#">我的收藏</a></li>
		<li><a href = "#">站内信</a></li>
		<li><a href = "#">搜索</a></li>
	</ul>
</div>

<div class = "main">
	<div class = "right">
		<div class = "top_ten">
			<h5>今日十大热门话题</h5>
		</div>

		<div class = "lectures">
			<h5>各类活动与讲座通知</h5>
		</div>

		<div class = "hot_sessions">
			<h5>热门讨论区</h5>
		</div>
	</div>

	<div class = "left">
		<div class = "headline">
			<h5>校园通告</h5>
		</div>

		<div class = "lost_news">
			<h5>失物招领</h5>
		</div>

		<div class = "suggest">
			<h5>精彩推荐文章</h5>
		</div>

		<div class = "all_sessions">
			<h5>分类讨论区</h5>
			<hr />
			<table class = "tb_boards">
				<tr>
					<td>
						<table>
							<tbody>
								<tr>
									<td>学院学术</td>
									<td>更多版面</td>
								</tr>

								<tr>
									<td><a href = "computer.php">计算机学院</a></td>
									<td><a href = "page.php?board=Renwen">人文学院</a></td>
									<td>生命科学学院</td>
									<td><a href = "page.php?board=Economics">经管学院</a></td>
									<td>艺术园林学院</td>
									<td><a href = "page.php?board=Animals" >动物科学</a></td>
								</tr>
							</tbody>
						</table>
					</td>
				</tr>

				<tr>
					<td>
						<table>
							<tbody>
								<tr>
									<td>感性理性</td>
									<td>更多版面</td>
								</tr>

								<tr>
									<td><a href = "page.php?board=Girls">女生天地</a></td>
									<td>百年好合</td>
									<td>男生天地</td>
									<td>心理卫生</td>
									<td>家庭生活</td>
									<td>百年孤独</td>
								</tr>
							</tbody>
						</table>
					</td>
				</tr>

				<tr>
					<td>
						<table>
							<tbody>
								<tr>
									<td>校园生活</td>
									<td>更多版面</td>
								</tr>

								<tr>
									<td>论坛讲座</td>
									<td>创业与求职</td>
									<td>兼职工作信息</td>
									<td>租房出租</td>
									<td>失物寻物</td>
									<td>二手交易</td>
								</tr>

							</tbody>
						</table>
					</td>
				</tr>
				
				<tr>
					<td>
						<table>
							<tbody>
								<tr>
									<td>体育娱乐</td>
									<td>更多版面</td>
								</tr>

								<tr>
									<td>世界足球</td>
									<td>篮球世界</td>
									<td>车迷世界</td>
									<td>斯诺克桌球</td>
									<td>自行车运动</td>
									<td>远古之守护</td>
								</tr>
							</tbody>
						</table>
					</td>
				</tr>

			</table>
		</div>
	</div>
</div>

<div class = "footer">
	<br />
	<p>-----------------版权所有---2013-2013--小树林BBS开发团队------------</p>
	<hr />
	<p>您是本站第XX位访客</p>
</div>

</body>
</html>